import request from '@/utils/request'

export function getList(query) {
  return request({
    url: 'v1/uw_graph',
    method: 'get',
    params: query
  })
}
export function UpdateAutoStatus(data) {
  return request({
    url: 'v1/uw_graph/' + data.Id,
    method: 'put',
    data
  })
}
export function createGraph(data) {
  return request({
    url: 'v1/uw_graph',
    method: 'post',
    data
  })
}

export function updateGraph(data) {
  return request({
    url: 'v1/uw_graph/' + data.id,
    method: 'put',
    data
  })
}

export function deleteGraph(id) {
  return request({
    url: 'v1/uw_graph/' + id,
    method: 'delete'
  })
}

export function serverList() {
  return request({
    url: 'server/server_list',
    method: 'get'
  })
}

export function AccountList() {
  return request({
    url: 'server/account_list',
    method: 'get'
  })
}

export function AddAccount(account) {
  return request({
    url: 'server/add_account',
    method: 'get',
    params: account
  })
}

export function AddServer(server) {
  return request({
    url: 'server/add_server',
    method: 'post',
    data: server
  })
}

export function TaskList(params) {
  return request({
    url: 'script/list',
    method: 'get',
    params: params
  })
}

export function TaskDetail(id) {
  return request({
    url: 'script/list/' + id,
    method: 'get'
  })
}

export function ExecTask(scriptData) {
  return request({
    url: 'script/exec',
    method: 'post',
    data: scriptData
  })
}

export function FileDistribute(disInfo) {
  return request({
    url: '/file/distribute',
    method: 'post',
    data: disInfo
  })
}

export function IssueDetail(id) {
  return request({
    url: 'file/list/' + id,
    method: 'get'
  })
}

export function FileTaskList(params) {
  return request({
    url: 'file/list',
    method: 'get',
    params: params
  })
}

export function DeleteUploadFile(filePath) {
  return request({
    url: 'file/delete_upload',
    method: 'delete',
    params: filePath
  })
}

export function DeleteServer(id) {
  return request({
    url: 'server/delete_server',
    method: 'delete',
    params: id
  })
}

export function RecordsList(params) {
  return request({
    url: 'records/list',
    method: 'get',
    params: params
  })
}
